home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 851 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.2 KB

  1. Path: news.bridge.net!news
  2. From: David Byrden <100101.2547@compuserve.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Passing C++ member functions to Xview notifier functions.
  5. Date: 7 Jan 1996 22:56:09 GMT
  6. Organization: self-employed
  7. Message-ID: <4cpj29$hlc@news.bridge.net>
  8. References: <4chhsn$sim@msunews.cl.msu.edu>
  9. NNTP-Posting-Host: ppp-mia1-39.bridge.net
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (Windows; I; 16bit)
  14.  
  15.  
  16. Robert;
  17.  
  18. C++ member functions take one 'invisible' parameter, i.e.
  19. the address of an object,which becomes 'this'. Thus,
  20. their addresses are not compatible with ordinary
  21. function pointers.
  22.  
  23. A completely general approach to this problem was
  24. discussed in the C++ Report, February 95. It involved
  25. a set of template classes. Objects of these classes store 
  26. both a function and an object address; these objects are 
  27. passed around and used as callbacks. Class information from 
  28. one program module never leak sinto another, as long as they 
  29. both designed from the start to use these callback classes 
  30. instead of function addresses.
  31.  
  32. For an immediate solution to your problem, you can see Phil
  33. Staite's post.
  34.  
  35.     David
  36.  
  37.  
  38.